﻿<phone:PhoneApplicationPage x:Class="MobiSms.Wasun.Views.MessageDetailsView"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                            xmlns:viewmodel="clr-namespace:MobiSms.ViewModel;assembly=MobiSms.ViewModel"
                            xmlns:UX="clr-namespace:MobiSms.UX;assembly=MobiSms.UX"
                            FontFamily="{StaticResource PhoneFontFamilyNormal}"
                            FontSize="{StaticResource PhoneFontSizeNormal}"
                            Foreground="{StaticResource PhoneForegroundBrush}"
                            Orientation="Portrait"
                            SupportedOrientations="Portrait"
                            d:DesignHeight="800"
                            d:DesignWidth="480"
                            shell:SystemTray.IsVisible="False"
                            mc:Ignorable="d">

    <!--  LayoutRoot contains the root grid where all other page content is placed  -->
    <Grid x:Name="LayoutRoot">
        <Grid.DataContext>
            <viewmodel:MessageDetailsViewModel />
        </Grid.DataContext>
        <Grid.Background>
            <ImageBrush ImageSource="{Binding GlobalSettings.BackgroundImage}" Stretch="{Binding GlobalSettings.BackgroundImageStretch}" />
        </Grid.Background>

        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>

        <controls:Pivot Title="{StaticResource IDS_APP_NAME}">

            <!--  Panorama item one  -->
            <controls:PivotItem Header="{StaticResource IDS_MESSAGE_DETAILS_BODY_HEADER}">
                <Grid>
                    <ScrollViewer>
                        <StackPanel>
                            <TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{StaticResource IDS_MESSAGE_SENDID}" />
                            <TextBlock Style="{StaticResource PhoneTextSubtleStyle}"
                                       Text="{Binding SelectedMessage.SendId, Converter={StaticResource MessageSendIdConverter}}" />
                            <TextBlock Style="{StaticResource PhoneTextTitle3Style}" Text=" "/>
                            <TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{StaticResource IDS_MESSAGE_CONTENT}" />
                            <TextBlock Style="{StaticResource PhoneTextSubtleStyle}"
                                       Text="{Binding SelectedMessage.Content}"
                                       TextWrapping="Wrap" />
                            <TextBlock Style="{StaticResource PhoneTextTitle3Style}" Text=" "/>
                            <TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{StaticResource IDS_MESSAGE_SERIAL}" />
                            <TextBlock Style="{StaticResource PhoneTextSubtleStyle}"
                                       Text="{Binding SelectedMessage.SerialNumber}" />
                            <TextBlock Style="{StaticResource PhoneTextTitle3Style}" Text=" "/>
                            <TextBlock Style="{StaticResource PhoneTextTitle2Style}" Text="{StaticResource IDS_MESSAGE_STATUS}" />
                            <TextBlock Style="{StaticResource PhoneTextSubtleStyle}"
                                       Text="{Binding SelectedMessage.Status, Converter={StaticResource EnumTranslateConverter}}" />
                        </StackPanel>
                    </ScrollViewer>
                </Grid>
            </controls:PivotItem>

            <!--  Panorama item two  -->
            <controls:PivotItem Header="{StaticResource IDS_MESSAGE_DETAILS_MOBILES_HEADER}">
                <Grid>
                    <ListBox ItemsSource="{Binding ItemsOfMobile}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Margin="12,0,0,12"
                                           Style="{StaticResource PhoneTextTitle3Style}"
                                           Text="{Binding Mobile}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>
        
        <Grid Grid.Row="1" Margin="12">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            
            <TextBlock VerticalAlignment="Center" Style="{StaticResource PhoneTextTitle2Style}">
                <Run Text="{Binding ItemsOfMobile.Count}"/>
                <Run Text=" "/>
                <Run Text="{StaticResource IDS_MESSAGE_MOBILES_COUNT_STRING}"/>
            </TextBlock>
            
            <UX:UXPathButton IconPath="{StaticResource PATH_ICON_DELETE}" Grid.Column="1" Margin="12,0" Command="{Binding DeleteCommand, Mode=OneWay}"/>
        </Grid>
    </Grid>

    <!--  Panorama-based applications should not show an ApplicationBar  -->

</phone:PhoneApplicationPage>